Integrand size = 43, antiderivative size = 303 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sqrt {\sec (c+d x)}}{(a+b \cos (c+d x))^2} \, dx=-\frac {\left (A b^2-a (b B-a C)\right ) \sqrt {\cos (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{a b \left (a^2-b^2\right ) d}-\frac {\left (A b^2-a b B-a^2 C+2 b^2 C\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right ) \sqrt {\sec (c+d x)}}{b^2 \left (a^2-b^2\right ) d}-\frac {\left (A b^4+a^3 b B+a b^3 B+a^4 C-3 a^2 b^2 (A+C)\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticPi}\left (\frac {2 b}{a+b},\frac {1}{2} (c+d x),2\right ) \sqrt {\sec (c+d x)}}{a (a-b) b^2 (a+b)^2 d}+\frac {\left (A b^2-a (b B-a C)\right ) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x)) \sqrt {\sec (c+d x)}} \]
[Out]
Time = 0.89 (sec) , antiderivative size = 302, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.163, Rules used = {4306, 3134, 3138, 2719, 3081, 2720, 2884} \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sqrt {\sec (c+d x)}}{(a+b \cos (c+d x))^2} \, dx=\frac {\sin (c+d x) \left (A b^2-a (b B-a C)\right )}{a d \left (a^2-b^2\right ) \sqrt {\sec (c+d x)} (a+b \cos (c+d x))}-\frac {\sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right ) \left (a^2 (-C)-a b B+A b^2+2 b^2 C\right )}{b^2 d \left (a^2-b^2\right )}-\frac {\sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \left (a^2 C-a b B+A b^2\right )}{a b d \left (a^2-b^2\right )}-\frac {\sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)} \left (a^4 C+a^3 b B-3 a^2 b^2 (A+C)+a b^3 B+A b^4\right ) \operatorname {EllipticPi}\left (\frac {2 b}{a+b},\frac {1}{2} (c+d x),2\right )}{a b^2 d (a-b) (a+b)^2} \]
[In]
[Out]
Rule 2719
Rule 2720
Rule 2884
Rule 3081
Rule 3134
Rule 3138
Rule 4306
Rubi steps \begin{align*} \text {integral}& = \left (\sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \frac {A+B \cos (c+d x)+C \cos ^2(c+d x)}{\sqrt {\cos (c+d x)} (a+b \cos (c+d x))^2} \, dx \\ & = \frac {\left (A b^2-a (b B-a C)\right ) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x)) \sqrt {\sec (c+d x)}}+\frac {\left (\sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \frac {\frac {1}{2} \left (-A b^2-a b B+a^2 (2 A+C)\right )-a (A b-a B+b C) \cos (c+d x)-\frac {1}{2} \left (A b^2-a (b B-a C)\right ) \cos ^2(c+d x)}{\sqrt {\cos (c+d x)} (a+b \cos (c+d x))} \, dx}{a \left (a^2-b^2\right )} \\ & = \frac {\left (A b^2-a (b B-a C)\right ) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x)) \sqrt {\sec (c+d x)}}-\frac {\left (\sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \frac {\frac {1}{2} b \left (A b^2+a b B-a^2 (2 A+C)\right )+\frac {1}{2} a \left (A b^2-a b B-a^2 C+2 b^2 C\right ) \cos (c+d x)}{\sqrt {\cos (c+d x)} (a+b \cos (c+d x))} \, dx}{a b \left (a^2-b^2\right )}+\frac {\left (\left (-A b^2+a (b B-a C)\right ) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \sqrt {\cos (c+d x)} \, dx}{2 a b \left (a^2-b^2\right )} \\ & = -\frac {\left (A b^2-a b B+a^2 C\right ) \sqrt {\cos (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{a b \left (a^2-b^2\right ) d}+\frac {\left (A b^2-a (b B-a C)\right ) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x)) \sqrt {\sec (c+d x)}}-\frac {\left (\left (A b^2-a b B-a^2 C+2 b^2 C\right ) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \frac {1}{\sqrt {\cos (c+d x)}} \, dx}{2 b^2 \left (a^2-b^2\right )}-\frac {\left (\left (A b^4+a^3 b B+a b^3 B+a^4 C-3 a^2 b^2 (A+C)\right ) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \frac {1}{\sqrt {\cos (c+d x)} (a+b \cos (c+d x))} \, dx}{2 a b^2 \left (a^2-b^2\right )} \\ & = -\frac {\left (A b^2-a b B+a^2 C\right ) \sqrt {\cos (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{a b \left (a^2-b^2\right ) d}-\frac {\left (A b^2-a b B-a^2 C+2 b^2 C\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right ) \sqrt {\sec (c+d x)}}{b^2 \left (a^2-b^2\right ) d}-\frac {\left (A b^4+a^3 b B+a b^3 B+a^4 C-3 a^2 b^2 (A+C)\right ) \sqrt {\cos (c+d x)} \operatorname {EllipticPi}\left (\frac {2 b}{a+b},\frac {1}{2} (c+d x),2\right ) \sqrt {\sec (c+d x)}}{a (a-b) b^2 (a+b)^2 d}+\frac {\left (A b^2-a (b B-a C)\right ) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x)) \sqrt {\sec (c+d x)}} \\ \end{align*}
Time = 7.41 (sec) , antiderivative size = 508, normalized size of antiderivative = 1.68 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sqrt {\sec (c+d x)}}{(a+b \cos (c+d x))^2} \, dx=\frac {\frac {4 a b^2 \left (A b^2+a (-b B+a C)\right ) \sin (c+d x)}{a^2-b^2}+\frac {\cos (c+d x) \cot (c+d x) (b+a \sec (c+d x)) \sec (2 (c+d x)) \left (-8 a^2 b (A b-a B+b C) \cos (2 (c+d x)) \operatorname {EllipticPi}\left (-\frac {a}{b},\arcsin \left (\sqrt {\sec (c+d x)}\right ),-1\right ) \sqrt {\sec (c+d x)} \sqrt {-\tan ^2(c+d x)}+\frac {2 b^2 \left (3 A b^2+a b B-a^2 (4 A+C)\right ) \left (\operatorname {EllipticF}\left (\arcsin \left (\sqrt {\sec (c+d x)}\right ),-1\right )-\operatorname {EllipticPi}\left (-\frac {a}{b},\arcsin \left (\sqrt {\sec (c+d x)}\right ),-1\right )\right ) \left (-2+\sec ^2(c+d x)\right ) \sqrt {-\tan ^2(c+d x)}}{\sec ^{\frac {3}{2}}(c+d x)}+\left (A b^2+a (-b B+a C)\right ) \cos (2 (c+d x)) \left (4 a b-4 a b \sec ^2(c+d x)+4 a b E\left (\left .\arcsin \left (\sqrt {\sec (c+d x)}\right )\right |-1\right ) \sqrt {\sec (c+d x)} \sqrt {-\tan ^2(c+d x)}-2 (2 a-b) b \operatorname {EllipticF}\left (\arcsin \left (\sqrt {\sec (c+d x)}\right ),-1\right ) \sqrt {\sec (c+d x)} \sqrt {-\tan ^2(c+d x)}+4 a^2 \operatorname {EllipticPi}\left (-\frac {a}{b},\arcsin \left (\sqrt {\sec (c+d x)}\right ),-1\right ) \sqrt {\sec (c+d x)} \sqrt {-\tan ^2(c+d x)}-2 b^2 \operatorname {EllipticPi}\left (-\frac {a}{b},\arcsin \left (\sqrt {\sec (c+d x)}\right ),-1\right ) \sqrt {\sec (c+d x)} \sqrt {-\tan ^2(c+d x)}\right )\right )}{(a-b) (a+b)}}{4 a^2 b^2 d (a+b \cos (c+d x)) \sqrt {\sec (c+d x)}} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. \(814\) vs. \(2(367)=734\).
Time = 5.87 (sec) , antiderivative size = 815, normalized size of antiderivative = 2.69
[In]
[Out]
Timed out. \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sqrt {\sec (c+d x)}}{(a+b \cos (c+d x))^2} \, dx=\text {Timed out} \]
[In]
[Out]
\[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sqrt {\sec (c+d x)}}{(a+b \cos (c+d x))^2} \, dx=\int \frac {\left (A + B \cos {\left (c + d x \right )} + C \cos ^{2}{\left (c + d x \right )}\right ) \sqrt {\sec {\left (c + d x \right )}}}{\left (a + b \cos {\left (c + d x \right )}\right )^{2}}\, dx \]
[In]
[Out]
\[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sqrt {\sec (c+d x)}}{(a+b \cos (c+d x))^2} \, dx=\int { \frac {{\left (C \cos \left (d x + c\right )^{2} + B \cos \left (d x + c\right ) + A\right )} \sqrt {\sec \left (d x + c\right )}}{{\left (b \cos \left (d x + c\right ) + a\right )}^{2}} \,d x } \]
[In]
[Out]
\[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sqrt {\sec (c+d x)}}{(a+b \cos (c+d x))^2} \, dx=\int { \frac {{\left (C \cos \left (d x + c\right )^{2} + B \cos \left (d x + c\right ) + A\right )} \sqrt {\sec \left (d x + c\right )}}{{\left (b \cos \left (d x + c\right ) + a\right )}^{2}} \,d x } \]
[In]
[Out]
Timed out. \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sqrt {\sec (c+d x)}}{(a+b \cos (c+d x))^2} \, dx=\int \frac {\sqrt {\frac {1}{\cos \left (c+d\,x\right )}}\,\left (C\,{\cos \left (c+d\,x\right )}^2+B\,\cos \left (c+d\,x\right )+A\right )}{{\left (a+b\,\cos \left (c+d\,x\right )\right )}^2} \,d x \]
[In]
[Out]